In storage devices in which a nonvolatile memory (for example, NAND type flash memory) is implemented, for example, in memory cards such as SD (Secure Digital) card, it is generally assumed that a bit error may occur.
For example, in the NAND type flash memory, an error may be generated by data contamination (data retention), which is caused by electrons stored in a floating gate that escape naturally or by data contamination (read disturbance) due to the stress of repetition, etc., of reading of the same block. For this reason, it is common, when using flash memory, to correct such bit errors by an error correction technique using an ECC (error checking and correction) circuit.
Although the correctability of the ECC circuit depends upon the algorithm of the ECC, the bit error can be completely corrected so long as the bit error is within a correctable range of the algorithm.
On the other hand, when the bit error exceeds the correctable range of the algorithm, the ECC circuit cannot completely correct the bit error, and a controller for the memory unit is notified of the occurrence of the error. In such a case, the memory unit cannot output correct data but notifies a host device of the occurrence of the error. Hereinafter, the error notified from the ECC circuit after the occurrence of an uncorrectable error in the ECC circuit will be referred to as an ECC error.
When bit errors are severe enough to cause ECC errors, various problems may be the cause and should be investigated. For example, there may be a problem with data retention or read disturbance (this is a NAND memory cell problem due to a process during the manufacture), or a problem with the firmware for controlling the NAND type flash memory, or there may be a problem due to an access pattern of the host device, or the NAND type flash memory may have reached end of life.
Sometimes, it is necessary to investigate the cause of the occurrence of the ECC error, in which case a physical block in the NAND type flash memory in which the ECC error has occurred is required to be known. In case the physical block associated with the ECC error is the physical block in which the ECC error has occurred initially, it is easy to identify the physical block.
However, in some instances, the physical block associated with the ECC error is copied to another physical block as part of a background process, depending upon the algorithm of firmware that is implemented by the controller. Consequently, in such cases, the physical block associated with the ECC error is no longer the physical block in which the ECC error initially occurred.
For example, in the case where the ECC error has occurred in the data of an address written in a certain physical block, when additional data are written in the same physical block in portions of the physical block other than the physical address at which the ECC error has occurred, the additional data are not written to that physical block. Instead, the additional data and the data in which the ECC error has occurred are written to a new physical block, due to the characteristics of NAND type flash memory. Thus, data in which the ECC error has occurred are copied from the original physical block to the new physical block. Next, after copying the data in which the ECC error has occurred to the new physical block and writing the new data to the new physical block, a table showing the correlation between logical addresses and physical addresses is updated accordingly.
In this case, since the correlation of the logical address and the physical block in which the ECC error has actually occurred is overwritten, it is difficult to identify the physical block in which the ECC error has actually occurred.
A technique for registering/managing the physical block has been proposed when an ECC error has occurred; however when the ECC error occurs in reading a specific block of the NAND type flash memory, the block is the only block that is undergoing such registration/management. For this reason, if another physical block is copied in a background process and the physical block is changed, it is still not possible to identify the physical block in which the ECC error has actually occurred.